#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char const *argv[])
{
    printf("argc = %d\n", argc);

    // for (int i = 1; i < argc; i++)
    // {
    //     printf("argv[%d] = %s\n", i, argv[i]);
    // }

    int fd1, fd2;
    fd1 = open(argv[1], O_RDWR);
    fd2 = open(argv[1], O_RDWR);

    int res_read, res_write;
    char buf[1024];
    res_read = read(fd1, buf, 5);
    printf("read %d bytes ,buf = %s\n", res_read, buf);

    res_write = write(fd2, "xxxxx", 5);
    printf("write %d bytes\n", res_write);
    return 0;
}
